﻿@model CW_Menu

@{
    ViewBag.Title = "MenuCreate";
    IEnumerable<CW_Menu> parentList = ViewBag.ParentList;
}

<h2>MenuCreate</h2>
<div>
    @Html.ActionLink("Back to List", "MenuList", null, new { Class = "btn btn-default" })
</div>
<hr />
@using (Html.BeginForm("MenuCreate", "Admin", FormMethod.Post, new { id = "form1", Class = "from", onsubmit = "return checkInput();", enctype = "multipart/form-data" }))
{
    <div class="form-group">
        <label>标题</label>
        <input type="text" class="form-control" name="MenuName" data-rule-required='true' data-msg-required="请输入标题">
    </div>
    <div class="form-group">
        <label>网址</label>
        <input type="text" class="form-control" name="Url" data-rule-required='true' data-msg-required="请输入网址">
    </div>
   
    <div class="form-group">
        <label>父级菜单</label>
        <div>
            <label class="radio-inline">
                <input type="radio" name="ParentId" value="" />没有
            </label>
            @foreach (var p in parentList)
            {
                <label class="radio-inline">
                    <input type="radio" name="ParentId" value="@p.MenuId" />@p.MenuName
                </label>
            }
        </div>
    </div>
     <div class="form-group">
        <div class="checkbox">
            <label>
                <input type="checkbox" name="IsParent" value="true">可做父级菜单
            </label>
        </div>        
    </div>
    <div class="form-group hidden">
        <label>Icon</label>
        <input type="text" class="form-control" name="Icon">
    </div>
    <div class="form-group">       
        <div class="checkbox">
            <label>
                <input type="checkbox" name="IsShow" value="true">显示
            </label>
        </div>
    </div>

    <button type="submit" class="btn btn-default">Submit</button>
}


@section Scripts {
    <script src="~/scripts/jquery.validate.min.js"></script>
    <script src="~/scripts/jquery.form.js"></script>
    <script>
        $(function () {
            validateCN();
        })
        function validateCN() {
            $("form").validate({
                errorClass: "text-danger text-sm",
                errorPlacement: function (error, element) {
                    element.after(error);
                }
            });
        }
        function checkInput() {
            return $("#form1").valid();
        }
    </script>
}
